import React, { Component } from 'react'
// import C from '../1_setState'
import './index.css'

export default class Parent extends Component {
    render() {
        return (
            <div className='parent'>
                <h3>我是Parent组建</h3>
                <A render={(name)=><B name={name}/>}/>
            </div>
        )
    }
}

class A extends Component {
    state ={name:'tom'}
    render() {
        return (
            <div className='a'>
                <h3>我是A组建</h3>
                {this.props.render(this.state.name)}
            </div>
        )
    }
}


class B extends Component {
    render() {
        return (
            <div className='b'>
                <h3>我是B组建,{this.props.name}</h3>
            </div>
        )
    }
}
